package ca.ualberta.cs.CLRDB;

import java.sql.SQLException;
import java.sql.Statement;

public class WatchListManagement extends EntityRelManagement{

	@Override
	public void initialize(Statement statement) throws SQLException {
		try{
			statement.executeUpdate("drop table WatchList");			
		}
		catch(Exception e){}		
		
		statement.executeUpdate("CREATE TABLE WatchList (" +
				"personId INTEGER NOT NULL, " +
				"resourceId INTEGER NOT NULL, " +
				"CONSTRAINT FK_resourceid FOREIGN KEY (resourceId) " +
					"REFERENCES Resource (ID) ON DELETE CASCADE, " +
				"CONSTRAINT FK_personid FOREIGN KEY (personId) " +
					"REFERENCES Person (ID) ON DELETE CASCADE, " +
				"CONSTRAINT PK_watchlist PRIMARY KEY (resourceId, personId) " +
				") IN CLRSPACE ");
		numOfCols = 2;		
	}

}
